﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AlgorithmBox.FlowCharts
{
	/// <summary>
	/// Interaction logic for InputBox.xaml
	/// </summary>
	public partial class InputBox : Window
	{
		public string Result;
		public string VarName;
		public string VarType;

		public InputBox()
		{
			InitializeComponent();
		}

		private void InputOk_Click(object sender, RoutedEventArgs e)
		{
			if (this.VarType == "Convert.ToChar")
				this.Result = ((int)textInput.Text[0]).ToString();
			else if (this.VarType == "Convert.ToString")
				this.Result = "\"" + textInput.Text + "\"";
			else
				this.Result = textInput.Text;
			this.DialogResult = true;
		}

		public bool GetVariable()
		{
			textQuestion.Text = String.Format("{0} degerini giriniz! ({1})",
				VarName,
				VarType);

			return (bool)this.ShowDialog();
		}
	}
}
